package ink.chow.jdbc.sharding.conf;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import net.bytebuddy.asm.Advice.Return;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

@Configuration
public class Swagger2Config {
	
	@Bean
	public Docket createRestAPI() {
		return new Docket(DocumentationType.SWAGGER_2)
				.apiInfo(apiInfo()).select()
				.apis(RequestHandlerSelectors.basePackage("ink.chow.jdbc.sharding.ctrl"))
				.paths(PathSelectors.any()).build();
				
	}
	
	private ApiInfo apiInfo() {
		return new ApiInfoBuilder().title("api")
				.version("0.0.1")
				.description("api文档")
				.build();
	}
}
